import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { RoleService } from './role.service';
import { CreateRoleDto, QueryRoleDto } from './role.dto'

@Controller('admin/role')
export class RoleController {
  constructor(private readonly roleService: RoleService) { }

  @Post('add')
  addRole(@Body() createRoleDto: CreateRoleDto) {
    return this.roleService.addRole(createRoleDto);
  }

  @Get('list')
  getRoleList() {
    return this.roleService.getRoleList();
  }

  @Get('page')
  getRolePage(@Query() queryRoleDto: QueryRoleDto) {
    return this.roleService.getRolePage(queryRoleDto);
  }

  @Get(':roleId')
  getRoleInfo(@Param('roleId') roleId: string) {
    return this.roleService.getRoleInfo(+roleId);
  }
}
